﻿ @using MvcPaging
 @model MvcPaging.IPagedList<TuanAnhPersonalWeb.Models.AccountList>

 <table>
        <tr>
            <th></th>
            <th>
                UserName
            </th>
            <th>
                Lowered UserName
            </th>
            <th>
                Last Activity Date
            </th>
            <th>
              Is Locked
            </th>
        </tr>
   @if (Model.Count > 0) { 
    foreach (var item in Model){
        <tr>
            <td>
                @Html.ActionLink("Edit", "Edit", new { userID = item.user.UserId }) |
                @Html.ActionLink("Details", "Details", new { userID = item.user.UserId }) |
                @Html.ActionLink("Reset Password", "ResetPw", new { userID = item.user.UserId })|
               @Html.ActionLink("Delete", "Delete", new { userID = item.user.UserId })           
            </td>            
            <td>
                @item.user.UserName
            </td>
            <td>
                @item.user.LoweredUserName
            </td>           
            <td>
              @String.Format("{0:g}", item.user.LastActivityDate)
            </td>
            <td>
              @item.islocked.ToString()

              @if (item.islocked==true)
              {
                 @Html.ActionLink("Unlock", "UnlockUser", new { userID = item.user.UserId })     
              }
            </td>
        </tr>    
    }
   }
   else
   { 
        <tr>
            <td colspan="4" align="center">No data to display</td>
        </tr>
   } 
    </table>

    <div class="pager">
  @Ajax.Pager(ViewData.Model.PageSize, ViewData.Model.PageNumber, ViewData.Model.TotalItemCount, new { controller = "Account", action = "Search"  ,keySearch = ViewData["keySearch"], valSearch = ViewData["valSearch"]}, new AjaxOptions { UpdateTargetId = "divGrid", OnBegin = "beginPaging", OnSuccess = "successPaging" })
 </div>